package me.security.controller;

import java.util.List;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import me.security.bean.Role;
import me.security.dao.RoleDao;

@Controller
@RequestMapping("/role/")
public class RoleController {
	private final Logger logger = Logger.getLogger("RoleController");
	
	@Autowired(required=true)
	private RoleDao roleDao;
	
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public String index(HttpServletRequest request, HttpServletResponse response, Model model){
		logger.info("account/index");
		//roleDao
		try {
			List<Role> list = roleDao.findAll();
			logger.info("[" + list.size() + " ]");
			//	model.addAttribute("listRow", list);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return "role/index";
	}
	
}
